package com.ygl.common.entity;

/**
 * author: yanggld
 * date: 2019/12/14 14:46
 * version: 1.0
 * description: HostFilterType
 */
public enum HostFilterType {
    BLACKLIST("blacklist", "blacklist"),
    WHITELIST("whitelist", "whitelist");

    private String value;
    private String description;

    private HostFilterType(String value, String description) {
        this.value = value;
        this.description = description;
    }

    public String getValue() {
        return value;
    }

    public String getDescription() {
        return description;
    }

    public static HostFilterType fromString(String value) {
        for (HostFilterType type : HostFilterType.values()) {
            if (type.getValue().equalsIgnoreCase(value)) {
                return type;
            }
        }

        throw new IllegalArgumentException("No matched type with value=" + value);
    }

    @Override
    public String toString() {
        return value;
    }
}
